<?php


if (!empty($_SESSION['login'])&&!empty($_SESSION['email'])){

$db = new Mypdo();
$loyerManager = new LoyerManager($db);
$listeLoyer = $loyerManager->getListByIdLoca($_GET['id']);
?>
<table class="tableau">
        <tr>
            <th>Date</th>
            <th>Remarque</th>
            <th>Montant</th>
            <th>Loyer acquitter</th>
            <th>Détail</th>
        </tr>
<?php
    foreach ($listeLoyer as $value) {
    ?>

        <tr>
            <td><?php echo $value->getDateLoyer(); ?></td>
            <td><?php echo $value->getRemarqueLoyer(); ?></td>
            <td><?php echo $value->getSoldePayerLoyer(); ?></td>
            <td><?php echo $value->getStatutLoyer()==0?'<img id="ico" src="image/erreur.png" alt="Non Payer">':'<img id="ico" src="image/valid.png" alt="Payer">'; ?></td>
            <td><input id="detail" name="detail" type="button" onclick="document.location.href='index.php?page=214&idla=<?php echo $value->getIdLoca(); ?>&idl=<?php echo $value->getIdLoc(); ?>&date=<?php echo $value->getDateLoyer(); ?>'" /></td>
        </tr>


<?php

}


?>
</table>

<input id="imp" name="imp" type="button" value="Imprimer" onclick="document.location.href='include/pages/impLoyer.php?id=<?php echo $_GET['id']; ?>'" />

<?php }else{
    header('Location: index.php');
}